    <table>
        <tr>
            <td>Template Name</td>
            <td><input name="template" type="text" value="<?php echo $_POST['template'];?>"></td>
        </tr>
    </table>
    Major Requirements <input type="button" onclick="addMaj()" value="Add more">
    <ul><table id="maj" border="1" align="center" style="text-align:center">
    <?php
        for($majorIndex=0;;$majorIndex++){
            if($_POST['majName'.$majorIndex]==NULL){
				if($majorIndex==0){
					echo
					   "<tr>
							<td><li>Name</li></td>
							<td><input name=\"majName0\" type=\"text\"></td>
							<td>Percentage</td>
							<td><input name=\"majPer0\" type=\"text\"></td>
						</tr>";
					echo "<tr><td colspan=\"4\"><li>Minor Requirements <input type=\"button\" onclick=\"addMin(0)\" value=\"Add more\"></li></td></tr>";
					echo "<tr><td colspan=\"4\"><table id=\"min0\">";
					echo
						"<tr>
							<td><ul><li>Name</li></ul></td>
							<td><input name=\"minName00\" type=\"text\"></td>
							<td>Max Raw Score</td>
							<td><input name=\"minSco00\" type=\"text\"></td>
						</tr>";
					echo "</table></td></tr>";
				}
				break;
			}
			if($_POST['majName'.$majorIndex]!="~NULL"){
				echo
				   "<tr>
					<td><li>Name</li></td>
					<td><input name=\"majName".$majorIndex."\" type=\"text\" value=\"".$_POST['majName'.$majorIndex]."\"></td>
					<td>Percentage</td>
					<td><input name=\"majPer".$majorIndex."\" type=\"text\" value=\"".$_POST['majPer'.$majorIndex]."\"></td>";
				if($majorIndex!=0)
					echo "<td rowspan=\"3\"><input type=\"button\" value=\"Remove\" onclick=\"remMaj(".$majorIndex.")\"></td></tr>";
				echo "<tr><td colspan=\"4\"><li>Minor Requirements <input type=\"button\" onclick=\"addMin(".$majorIndex.")\" value=\"Add more\"></li></td></tr>";
				echo "<tr><td colspan=\"4\"><table id=\"min".$majorIndex."\">";
				for($minorIndex=0;;$minorIndex++){
					if($_POST['minName'.$majorIndex.$minorIndex]==NULL){
						if($minorIndex==0){
							echo
								"<tr>
									<td><ul><li>Name</li></ul></td>
									<td><input name=\"minName".$majorIndex."0\" type=\"text\"></td>
									<td>Max Raw Score</td>
									<td><input name=\"minSco".$majorIndex."0\" type=\"text\"></td>";
						}
						break;
					}
					if($_POST['majName'.$majorIndex]!="~NULL"){
						echo
							"<tr>
								<td><ul><li>Name</li></ul></td>
								<td><input name=\"minName".$majorIndex.$minorIndex."\" type=\"text\" value=\"".$_POST['minName'.$majorIndex.$minorIndex]."\"></td>
								<td>Max Raw Score</td>
								<td><input name=\"minSco".$majorIndex.$minorIndex."\" type=\"text\" value=\"".$_POST['minSco'.$majorIndex.$minorIndex]."\"></td>";
						if($majorIndex!=0 && $minorIndex!=0)
							echo "<td><input type=\"button\" value=\"Remove\" onclick=\"remMin(".$majorIndex.",".$minorIndex.")\"></td></tr>";
					}
				}
				echo "</table></td></tr>";
			}
        }
		
    ?>
    <tr><td colspan="5" align="right"><input type="submit" value="Save"></td></tr>
    </table></ul>
</form>